#include "UIFunction.j"

// 定义一些UI相关
library UIInit requires YDWEAbilityState, FdfFile
    globals
        // UIhash
        hashtable UI_HASH = InitHashtable()

        integer array SYS_UI

        // 需要动态显示的UI
        integer array UI_Animation

        // 当前动态显示的i
        integer UI_Animation_i = 0
    endglobals

    // 获取鼠标指向的物品(异步使用)
    function getMouseItem takes nothing returns item
        call FlushChildHashtable( UI_HASH, 100)
        call SaveFogStateHandle( UI_HASH, 100, 1, ConvertFogState(GetHandleId(DzGetUnitUnderMouse())))
        return LoadItemHandle( UI_HASH, 100, 1)
    endfunction
    

    // ============================================================

    // 游戏上方进攻倒计时
    private function showEnemyTimerTip takes nothing returns nothing
        local integer i
        set i = 0
        set SYS_UI[i] = DzCreateFrameByTagName("BACKDROP", "name", DzGetGameUI(), "template", 0)
        call DzFrameSetSize( SYS_UI[i], 0.12, 0.04 )
        call DzFrameSetTexture( SYS_UI[i], "MyTimeIndicatorFrame.tga", 0 )
        call DzFrameSetPoint( SYS_UI[i], 4, DzGetGameUI(), 4, 0.00, 0.28 )
        call DzFrameShow( SYS_UI[i], true )
        set i = 1
        set SYS_UI[i] = DzCreateFrameByTagName("TEXT", "name", SYS_UI[0], "UI_TEXT_11", 0)
        call DzFrameSetSize( SYS_UI[i], 0.10, 0.00 )
        call DzFrameSetPoint( SYS_UI[i], 4, SYS_UI[0], 4, 0.00, 0.008 )
        call DzFrameSetText( SYS_UI[i], "|cff00ff00选择难度|r" )
        set i = 2
        set SYS_UI[i] = DzCreateFrameByTagName("TEXT", "name", SYS_UI[0], "UI_TEXT_12", 0)
        call DzFrameSetSize( SYS_UI[i], 0.10, 0.00 )
        call DzFrameSetPoint( SYS_UI[i], 4, SYS_UI[0], 4, 0.00, -0.009 )
        call DzFrameSetText( SYS_UI[i], "|cff00ff00准备阶段|r" )
    endfunction

    // =============================== 物品提示 ============================================
    // 初始化物品提示UI(该函数放到触发器里面调用初始化，放到最后，因为要显示的时候显示到其他UI的上方)

    function initTipUI takes nothing returns nothing

        local integer ui = StringHash("TIPUI")

        // 背景
        call SaveInteger(UI_HASH,ui,1,DzCreateFrameByTagName("BACKDROP", "name", DzGetGameUI(), "fftip", 0))
        // 图标
        call SaveInteger(UI_HASH,ui,2,DzCreateFrameByTagName("BACKDROP", "name", (LoadInteger(UI_HASH,ui,1)),"template", 0))
        // 名字
        call SaveInteger(UI_HASH,ui,3,DzCreateFrameByTagName("TEXT", "name", (LoadInteger(UI_HASH,ui,1)),"UI_TEXT_12_LEFT", 0))
        // 提示
        call SaveInteger(UI_HASH,ui,4,DzCreateFrameByTagName("TEXT", "name", (LoadInteger(UI_HASH,ui,1)),"UI_TEXT_11_LEFT", 0))
        // 价格提示
        call SaveInteger(UI_HASH,ui,5,DzCreateFrameByTagName("TEXT", "name", (LoadInteger(UI_HASH,ui,1)),"UI_TEXT_11_LEFT", 0))
        // 最后的tip提示
        call SaveInteger(UI_HASH,ui,6,DzCreateFrameByTagName("TEXT", "name", (LoadInteger(UI_HASH,ui,1)),"UI_TEXT_10_LEFT", 0))

        call DzFrameSetSize( LoadInteger(UI_HASH,ui,2), 0.038, 0.038 )
        call DzFrameSetSize( LoadInteger(UI_HASH,ui,4), 0.20, 0.00 )

        // 初始化位置
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,4), 8, DzGetGameUI(), 8,-0.012, 0.17 )
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,2), 6, LoadInteger(UI_HASH,ui, 4), 0, 0.00, 0.01 )
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,3), 0, LoadInteger(UI_HASH,ui, 2), 2, 0.01, 0.00 )
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,5), 6, LoadInteger(UI_HASH,ui, 2), 8, 0.01, 0.00 )
        // 定位tip提示
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,6), 0, LoadInteger(UI_HASH,ui, 4), 6, 0.00, -0.01 )
        // call DzFrameSetFont( (LoadInteger(UI_HASH,ui,3)), UITipFont, 0.013, 0 )
        // call DzFrameSetFont( (LoadInteger(UI_HASH,ui,4)), UITipFont, 0.0105, 0 )
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,1), 0, LoadInteger(UI_HASH,ui, 2), 0, -0.01, 0.01 )
        // call DzFrameSetPoint( LoadInteger(UI_HASH,ui,1), 8, LoadInteger(UI_HASH,ui, 4), 8, 0.01, -0.01 )
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,1), 8, LoadInteger(UI_HASH,ui, 4), 8, 0.01, -0.028 )
        call DzFrameShow( (LoadInteger(UI_HASH,ui, 1)), false )
    endfunction

    // 鼠标提示2,（有需求的
    function initTipUI3 takes nothing returns nothing

        local integer ui = StringHash("TIPUI3")

        // 背景
        call SaveInteger(UI_HASH,ui,1,DzCreateFrameByTagName("BACKDROP", "name", DzGetGameUI(), "fftip", 0))
        // 图标
        call SaveInteger(UI_HASH,ui,2,DzCreateFrameByTagName("BACKDROP", "name", (LoadInteger(UI_HASH,ui,1)),"template", 0))
        // 名字
        call SaveInteger(UI_HASH,ui,3,DzCreateFrameByTagName("TEXT", "name", (LoadInteger(UI_HASH,ui,1)),"UI_TEXT_12_LEFT", 0))
        // 提示
        call SaveInteger(UI_HASH,ui,4,DzCreateFrameByTagName("TEXT", "name", (LoadInteger(UI_HASH,ui,1)),"UI_TEXT_11_LEFT", 0))
        // 价格提示
        call SaveInteger(UI_HASH,ui,5,DzCreateFrameByTagName("TEXT", "name", (LoadInteger(UI_HASH,ui,1)),"UI_TEXT_11_LEFT", 0))
        // 最后的tip提示
        call SaveInteger(UI_HASH,ui,6,DzCreateFrameByTagName("TEXT", "name", (LoadInteger(UI_HASH,ui,1)),"UI_TEXT_10_LEFT", 0))

        call SaveInteger(UI_HASH,ui,8,DzCreateFrameByTagName("TEXT", "name", (LoadInteger(UI_HASH,ui,1)),"UI_TEXT_11_LEFT", 0))

        call DzFrameSetSize( LoadInteger(UI_HASH,ui,2), 0.038, 0.038 )
        call DzFrameSetSize( LoadInteger(UI_HASH,ui,4), 0.20, 0.00 )
        call DzFrameSetSize( LoadInteger(UI_HASH,ui,8), 0.20, 0.00 )

        // 初始化位置
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,4), 8, DzGetGameUI(), 8,-0.012, 0.17 )
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,8), 6, LoadInteger(UI_HASH,ui, 4), 0, 0.00, 0.01 )
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,2), 6, LoadInteger(UI_HASH,ui, 4), 0, 0.00, 0.025 )
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,3), 0, LoadInteger(UI_HASH,ui, 2), 2, 0.01, 0.00 )
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,5), 6, LoadInteger(UI_HASH,ui, 2), 8, 0.01, 0.00 )
        // 定位tip提示
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,6), 0, LoadInteger(UI_HASH,ui, 4), 6, 0.00, -0.01 )
        // 背景定位
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,1), 0, LoadInteger(UI_HASH,ui, 2), 0, -0.01, 0.01 )
        // 背景下方定位
        call DzFrameSetPoint( LoadInteger(UI_HASH,ui,1), 8, LoadInteger(UI_HASH,ui, 4), 8, 0.01, -0.01 )

        call DzFrameShow( (LoadInteger(UI_HASH,ui, 1)), false )
    endfunction

    // 显示数据面板的介绍(异步方法)（可以显示需求）
    function showTipWithDataPanel3 takes integer uid, string art, string name, string tip, string price, string suffix, integer fm, string xq returns nothing
        local integer i = StringHash("TIPUI3")
        local integer ui = StringHash("TIPUI3")

        call DzFrameSetTexture( LoadInteger(UI_HASH,i,2), art, 0 )
        call DzFrameSetText( LoadInteger(UI_HASH,i,3), name)
        call DzFrameSetText( LoadInteger(UI_HASH,i,4), tip )
        call DzFrameSetText( LoadInteger(UI_HASH,i,8), xq )
        call DzFrameSetText( LoadInteger(UI_HASH,i,5), price )
        call DzFrameSetText( LoadInteger(UI_HASH,i,6), suffix )
        if StringLength(suffix) == 0 then
            call DzFrameSetPoint( LoadInteger(UI_HASH,i,1), 8, LoadInteger(UI_HASH,i, 4), 8, 0.01, -0.01 )
        else
            call DzFrameSetPoint( LoadInteger(UI_HASH,i,1), 8, LoadInteger(UI_HASH,i, 4), 8, 0.01, -0.028 )
        endif
        // 如果没有需求，显示内容高度上移动
        if StringLength(xq) == 0 then
            call DzFrameSetPoint( LoadInteger(UI_HASH,ui,2), 6, LoadInteger(UI_HASH,ui, 4), 0, 0.00, 0.01 )
        else
            call DzFrameSetPoint( LoadInteger(UI_HASH,ui,2), 6, LoadInteger(UI_HASH,ui, 4), 0, 0.00, 0.025 )
        endif
        call DzFrameClearAllPoints( LoadInteger(UI_HASH,i,4) )
        // call DzFrameSetPoint( LoadInteger(UI_HASH,i,4), 8, DzGetGameUI(), 8, -0.012, 0.17 )
        call DzFrameSetPoint(LoadInteger(UI_HASH,i,4), 0, fm, 8, 0.01, -0.02)
        call DzFrameShow ( LoadInteger(UI_HASH,i,1), true )

    endfunction

    // 隐藏数据面板的介绍（异步方法）
    function hideTipWithDataPanel3 takes nothing returns nothing
        local integer i = StringHash("TIPUI3")
        
        call DzFrameShow ( LoadInteger(UI_HASH,i,1), false )
    endfunction

    // 显示数据面板的介绍(异步方法)
    function showTipWithDataPanel takes integer uid, string art, string name, string tip, string price, string suffix, integer fm returns nothing
        local integer i = StringHash("TIPUI")
        local integer ui = StringHash("TIPUI")

        call DzFrameSetTexture( LoadInteger(UI_HASH,i,2), art, 0 )
        call DzFrameSetText( LoadInteger(UI_HASH,i,3), name)
        call DzFrameSetText( LoadInteger(UI_HASH,i,4), tip )
        call DzFrameSetText( LoadInteger(UI_HASH,i,5), price )
        call DzFrameSetText( LoadInteger(UI_HASH,i,6), suffix )
        if StringLength(suffix) == 0 then
            call DzFrameSetPoint( LoadInteger(UI_HASH,i,1), 8, LoadInteger(UI_HASH,i, 4), 8, 0.01, -0.01 )
        else
            call DzFrameSetPoint( LoadInteger(UI_HASH,i,1), 8, LoadInteger(UI_HASH,i, 4), 8, 0.01, -0.028 )
        endif
        call DzFrameClearAllPoints( LoadInteger(UI_HASH,i,4) )
        call DzFrameSetPoint(LoadInteger(UI_HASH,i,4), 0, fm, 8, 0.01, -0.02)
        call DzFrameShow ( LoadInteger(UI_HASH,i,1), true )
    endfunction

    // 隐藏数据面板的介绍（异步方法）
    function hideTipWithDataPanel takes nothing returns nothing
        local integer i = StringHash("TIPUI")
        
        call DzFrameShow ( LoadInteger(UI_HASH,i,1), false )
    endfunction

    // 显示提示
    function showTip takes integer uid, string art, string name, string tip returns nothing
        local integer i = StringHash("TIPUI")

        if Player(uid) == GetLocalPlayer() then
            call DzFrameClearAllPoints( LoadInteger(UI_HASH,i,4) )
            call DzFrameSetPoint( LoadInteger(UI_HASH,i,4), 8, DzGetGameUI(), 8,-0.012, 0.17 )

            call DzFrameSetTexture( ( LoadInteger(UI_HASH,i,2)), art, 0 )
            call DzFrameSetText( (LoadInteger(UI_HASH,i,3)), name)
            call DzFrameSetText( (LoadInteger(UI_HASH,i,4)), tip )
            call DzFrameShow ( (LoadInteger(UI_HASH,i,1)), true )
        endif
    endfunction
    // 显示提示并且显示价格
    function showTipWithPrice takes integer uid, string art, string name, string tip, string price, string suffix returns nothing
        local integer i = StringHash("TIPUI")

        if Player(uid) == GetLocalPlayer() then

            call DzFrameClearAllPoints( LoadInteger(UI_HASH,i,4) )
            call DzFrameSetPoint( LoadInteger(UI_HASH,i,4), 8, DzGetGameUI(), 8,-0.012, 0.17 )

            call DzFrameSetTexture( LoadInteger(UI_HASH,i,2), art, 0 )
            call DzFrameSetText( LoadInteger(UI_HASH,i,3), name)
            call DzFrameSetText( LoadInteger(UI_HASH,i,4), tip )
            call DzFrameSetText( LoadInteger(UI_HASH,i,5), price )
            call DzFrameSetText( LoadInteger(UI_HASH,i,6), suffix )
            if StringLength(suffix) == 0 then
                call DzFrameSetPoint( LoadInteger(UI_HASH,i,1), 8, LoadInteger(UI_HASH,i, 4), 8, 0.01, -0.01 )
            else
                call DzFrameSetPoint( LoadInteger(UI_HASH,i,1), 8, LoadInteger(UI_HASH,i, 4), 8, 0.01, -0.028 )
            endif
            call DzFrameShow ( LoadInteger(UI_HASH,i,1), true )
        endif
    endfunction

    // 关闭显示
    function hideTip takes integer uid returns nothing
        local integer i = StringHash("TIPUI")
        call DzFrameShow ( (LoadInteger(UI_HASH,i,1)), false )
    endfunction

    // 鼠标地面提示的UI，因为鼠标位置一直移动刷新的问题，所以单独写个
    function initTipUI2 takes nothing returns nothing

        local integer ui = StringHash("TIPUI2")

        // 背景
        call SaveInteger(UI_HASH,ui,1,DzCreateFrameByTagName("BACKDROP", "name", DzGetGameUI(), "fftip", 0))
        // 图标
        call SaveInteger(UI_HASH,ui,2,DzCreateFrameByTagName("BACKDROP", "name", (LoadInteger(UI_HASH,ui,1)),"template", 0))
        // 名字
        call SaveInteger(UI_HASH,ui,3,DzCreateFrameByTagName("TEXT", "name", (LoadInteger(UI_HASH,ui,1)),"template", 0))
        // 提示
        call SaveInteger(UI_HASH,ui,4,DzCreateFrameByTagName("TEXT", "name", (LoadInteger(UI_HASH,ui,1)),"template", 0))


        call DzFrameSetSize( LoadInteger(UI_HASH,ui,2), 0.038, 0.038 )
        call DzFrameSetSize( LoadInteger(UI_HASH,ui,4), 0.20, 0.00 )

        // 初始化位置
        call DzFrameSetPoint( (LoadInteger(UI_HASH,ui,4)), 8, DzGetGameUI(), 8,-0.012, 0.17 )
        call DzFrameSetPoint( (LoadInteger(UI_HASH,ui,2)), 6, (LoadInteger(UI_HASH,ui, 4)), 0, 0.00, 0.01 )
        call DzFrameSetPoint( (LoadInteger(UI_HASH,ui,3)), 0, (LoadInteger(UI_HASH,ui, 2)), 2, 0.01, 0.00 )
        // call DzFrameSetFont( (LoadInteger(UI_HASH,ui,3)), UITipFont, 0.013, 0 )
        // call DzFrameSetFont( (LoadInteger(UI_HASH,ui,4)), UITipFont, 0.0105, 0 )
        call DzFrameSetPoint( (LoadInteger(UI_HASH,ui,1)), 0, (LoadInteger(UI_HASH,ui, 2)), 0, -0.01, 0.01 )
        call DzFrameSetPoint( (LoadInteger(UI_HASH,ui,1)), 8, (LoadInteger(UI_HASH,ui, 4)), 8, 0.01, -0.01 )
        call DzFrameShow( (LoadInteger(UI_HASH,ui, 1)), false )
    endfunction

    // 显示提示
    function showTip2 takes integer uid, string art, string name, string tip returns nothing
        local integer i = StringHash("TIPUI2")

        if Player(uid) == GetLocalPlayer() then
            call DzFrameSetTexture( ( LoadInteger(UI_HASH,i,2)), art, 0 )
            call DzFrameSetText( (LoadInteger(UI_HASH,i,3)), name)
            call DzFrameSetText( (LoadInteger(UI_HASH,i,4)), tip )
            call DzFrameShow ( (LoadInteger(UI_HASH,i,1)), true )
        endif
    endfunction

    // 关闭显示
    function hideTip2 takes integer uid returns nothing
        local integer i = StringHash("TIPUI2")
        call DzFrameShow ( (LoadInteger(UI_HASH,i,1)), false )
    endfunction

    // 进入物品格子
    function enterItem takes nothing returns nothing

        local integer uid = GetPlayerId(DzGetTriggerUIEventPlayer())
        // 格子Id
        local integer id = 0
        local item wp
        local integer wpId

        // 确定进入的格子
        if DzGetTriggerUIEventFrame() == DzFrameGetItemBarButton(0) then
            set id = 0
        elseif DzGetTriggerUIEventFrame() == DzFrameGetItemBarButton(1) then
            set id = 1
        elseif DzGetTriggerUIEventFrame() == DzFrameGetItemBarButton(2) then
            set id = 2
        elseif DzGetTriggerUIEventFrame() == DzFrameGetItemBarButton(3) then
            set id = 3
        elseif DzGetTriggerUIEventFrame() == DzFrameGetItemBarButton(4) then
            set id = 4
        elseif DzGetTriggerUIEventFrame() == DzFrameGetItemBarButton(5) then
            set id = 5
        endif

        set wp = UnitItemInSlot(NOW_UNIT[uid], id)
        if wp != null then
            set wpId = GetItemTypeId(wp)
            // call Feng_show_MouseTip(YDWEGetObjectPropertyString(YDWE_OBJECT_TYPE_ITEM, wpId, "Art"), YDWEGetObjectPropertyString(YDWE_OBJECT_TYPE_ITEM, wpId, "Tip"), null, YDWEGetObjectPropertyString(YDWE_OBJECT_TYPE_ITEM, wpId, "Ubertip"), null)
            // call showTip(uid, YDWEGetObjectPropertyString(YDWE_OBJECT_TYPE_ITEM, wpId, "Art"), YDWEGetObjectPropertyString(YDWE_OBJECT_TYPE_ITEM, wpId, "Name"), YDWEGetObjectPropertyString(YDWE_OBJECT_TYPE_ITEM, wpId, "Ubertip"))
            call showTip(uid, YDWEGetItemDataString(wpId, 1), YDWEGetItemDataString(wpId, 4), YDWEGetItemDataString(wpId, 3))
        endif
        set wp = null
    endfunction

    // 进入技能格子
    function enterSkill takes nothing returns nothing
        local integer uid = GetPlayerId(DzGetTriggerUIEventPlayer())
        local integer id
        local integer x
        local integer y
        local string ico
        local string tip
        local string tipExt
        local string tipPrice
        local string downTip
        local integer id2

        if DzGetTriggerUIEventFrame() == DzFrameGetCommandBarButton(0, 0) then
            // call BJDebugMsg(EXExecuteScript("('>I4'):pack((require 'jass.message').button(0,0))"))
            set x = 0
            set y = 0
            set id2 = 0
        elseif DzGetTriggerUIEventFrame() == DzFrameGetCommandBarButton(0, 1) then
            // call BJDebugMsg(EXExecuteScript("('>I4'):pack((require 'jass.message').button(1,0))"))
            set x = 0
            set y = 1
            set id2 = 1
        elseif DzGetTriggerUIEventFrame() == DzFrameGetCommandBarButton(0, 2) then
            // call BJDebugMsg(EXExecuteScript("('>I4'):pack((require 'jass.message').button(2,0))"))
            set x = 0
            set y = 2
            set id2 = 2
        elseif DzGetTriggerUIEventFrame() == DzFrameGetCommandBarButton(0, 3) then
            // call BJDebugMsg(EXExecuteScript("('>I4'):pack((require 'jass.message').button(3,0))"))
            set x = 0
            set y = 3
            set id2 = 3
        elseif DzGetTriggerUIEventFrame() == DzFrameGetCommandBarButton(1, 0) then
            set x = 1
            set y = 0
            set id2 = 4
        elseif DzGetTriggerUIEventFrame() == DzFrameGetCommandBarButton(1, 1) then
            set x = 1
            set y = 1
            set id2 = 5
        elseif DzGetTriggerUIEventFrame() == DzFrameGetCommandBarButton(1, 2) then
            set x = 1
            set y = 2
            set id2 = 6
        elseif DzGetTriggerUIEventFrame() == DzFrameGetCommandBarButton(1, 3) then
            set x = 1
            set y = 3
            set id2 = 7
        elseif DzGetTriggerUIEventFrame() == DzFrameGetCommandBarButton(2, 0) then
            set x = 2
            set y = 0
            set id2 = 8
        elseif DzGetTriggerUIEventFrame() == DzFrameGetCommandBarButton(2, 1) then
            set x = 2
            set y = 1
            set id2 = 9
        elseif DzGetTriggerUIEventFrame() == DzFrameGetCommandBarButton(2, 2) then
            set x = 2
            set y = 2
            set id2 = 10
        elseif DzGetTriggerUIEventFrame() == DzFrameGetCommandBarButton(2, 3) then
            set x = 2
            set y = 3
            set id2 = 11
        endif

        set id = S2I(EXExecuteScript("(require 'jass.message').button("+I2S(y)+","+I2S(x)+")"))

        // call BJDebugMsg("x = " + I2S(x) + " y = " + I2S(y))
        // call BJDebugMsg(EXExecuteScript("('>I4'):pack((require 'jass.message').button("+I2S(y)+","+I2S(x)+"))"))
        // call BJDebugMsg(EXExecuteScript("('>I4'):pack((require 'jass.message').button(0,0))"))
        // call BJDebugMsg("技能名称---：" + YDWEGetObjectPropertyString(YDWE_OBJECT_TYPE_ABILITY, id, "Name"))
        // call BJDebugMsg("物品名称---：" + YDWEGetItemDataString(id, 4))
        // call BJDebugMsg("单位名称---：" + YDWEGetObjectPropertyString(YDWE_OBJECT_TYPE_UNIT, id, "Name"))


        // 204  图标
        // 215  提示  - 显示提示主名称
        // 218  提示扩展 - 显示提示详情
        // 216  关闭提示 - 用于显示价格 - 比如需要价格等等
        // 219  关闭提示扩展 - 显示提示后缀
        set ico = YDWEGetUnitAbilityDataString(NOW_UNIT[uid], id, 1, 204)
        set tip = YDWEGetUnitAbilityDataString(NOW_UNIT[uid], id, 1, 215)
        set tipExt = YDWEGetUnitAbilityDataString(NOW_UNIT[uid], id, 1, 218)
        set tipPrice = YDWEGetUnitAbilityDataString(NOW_UNIT[uid], id, 1, 216)
        set downTip = YDWEGetUnitAbilityDataString(NOW_UNIT[uid], id, 1, 219)

        // call showTip(uid, YDWEGetObjectPropertyString(YDWE_OBJECT_TYPE_ABILITY, id, "Art"), YDWEGetObjectPropertyString(YDWE_OBJECT_TYPE_ABILITY, id, "Name"), YDWEGetObjectPropertyString(YDWE_OBJECT_TYPE_ABILITY, id, "Tip"))
        // call showTip(uid, YDWEGetUnitAbilityDataString(NOW_UNIT[uid], id, 1, 204), YDWEGetUnitAbilityDataString(NOW_UNIT[uid], id, 1, 215), YDWEGetUnitAbilityDataString(NOW_UNIT[uid], id, 1, 218))
        // 对技能提示重新规划
        // GetRealSelectUnit() 可以替换成 NOW_UNIT[uid]
        // 判断是否需要单独处理，有些NPC商店是物品，需要单独处理
        // if GetUnitTypeId(GetRealSelectUnit()) == 'h006' then
        //     set ico = h006Tip(id2, 1)
        //     set tip = h006Tip(id2, 2)
        //     set tipExt = h006Tip(id2, 3)
        //     set tipPrice = ""
        //     set downTip = ""
        // endif
        
        call showTipWithPrice(uid, ico, tip, tipExt, tipPrice, downTip)
    endfunction

    // 离开技能格子
    function leaveSkill takes nothing returns nothing
        local integer uid = GetPlayerId(DzGetTriggerUIEventPlayer())
        call hideTip(uid)
    endfunction

    // 离开物品格子
    function leaveItem takes nothing returns nothing
        local integer uid = GetPlayerId(DzGetTriggerUIEventPlayer())
        // call Feng_hide_MouseTip()
        call hideTip(uid)
    endfunction

    // 鼠标进入物品格子和技能格子
    // 模拟自定义物品和技能提示功能
    private function MouseTipInit takes nothing returns nothing

        local integer loopi 

        // 隐藏原生的物品提示
        call DzFrameSetPoint( DzFrameGetTooltip(), 8, DzGetGameUI(), 8, 0.3, 0.16 )

        // 注册事件
        set loopi = 0
        loop
            exitwhen loopi > 5
            call DzFrameSetScript( DzFrameGetItemBarButton(loopi), 2, "enterItem", false )
            call DzFrameSetScript( DzFrameGetItemBarButton(loopi), 3, "leaveItem", false )
            set loopi = loopi + 1
        endloop

        // 技能格子暂时待定
        call DzFrameSetScript( DzFrameGetCommandBarButton(0, 0), 2, "enterSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(0, 1), 2, "enterSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(0, 2), 2, "enterSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(0, 3), 2, "enterSkill", false )

        call DzFrameSetScript( DzFrameGetCommandBarButton(1, 0), 2, "enterSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(1, 1), 2, "enterSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(1, 2), 2, "enterSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(1, 3), 2, "enterSkill", false )

        call DzFrameSetScript( DzFrameGetCommandBarButton(2, 0), 2, "enterSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(2, 1), 2, "enterSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(2, 2), 2, "enterSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(2, 3), 2, "enterSkill", false )



        call DzFrameSetScript( DzFrameGetCommandBarButton(0, 0), 3, "leaveSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(0, 1), 3, "leaveSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(0, 2), 3, "leaveSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(0, 3), 3, "leaveSkill", false )

        call DzFrameSetScript( DzFrameGetCommandBarButton(1, 0), 3, "leaveSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(1, 1), 3, "leaveSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(1, 2), 3, "leaveSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(1, 3), 3, "leaveSkill", false )

        call DzFrameSetScript( DzFrameGetCommandBarButton(2, 0), 3, "leaveSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(2, 1), 3, "leaveSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(2, 2), 3, "leaveSkill", false )
        call DzFrameSetScript( DzFrameGetCommandBarButton(2, 3), 3, "leaveSkill", false )
    endfunction

    // 鼠标移动异步调用
    function mouseMoveAction takes nothing returns nothing
        local integer uid = GetPlayerId(DzGetTriggerKeyPlayer())
        local integer wpId
        if getMouseItem() != null then
            set wpId = GetItemTypeId(getMouseItem())
            call showTip2(uid, YDWEGetItemDataString(wpId, 1), YDWEGetItemDataString(wpId, 4), YDWEGetItemDataString(wpId, 3))
        else
            call hideTip2(uid)
        endif
    endfunction

    // 鼠标指向地面物品(已经用在T里面写了触发了，写这里会报错)
    // private function MouseTipInit2 takes nothing returns nothing
    //     // call YDLocalInitialize()
    //     // if GetLocalPlayer() == GetLocalPlayer() then
    //     //     call DzTriggerRegisterMouseMoveEventByCode( null, false, function mouseWpAction)
    //     // endif
    //     // call YDLocal1Release()
    // endfunction

    // 玩家按下Esc异步调用
    function playerEscAction takes nothing returns nothing
        local integer uid = GetPlayerId(DzGetTriggerKeyPlayer())

        call BJDebugMsg("ESC playerEscAction")
        // call BJDebugMsg("泄露字符串：" + I2S(GetCacheStringCount()))

        call BJDebugMsg("双击计时器：" + R2S(TimerGetElapsed(double_timer)))
    endfunction


    // 技能按钮显示模型
    private function initSkillCommand takes nothing returns nothing
        local integer ui = StringHash("技能格子刷新特效")
        local integer i

        // 创建一个统一的父
        set i = 0
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("FRAME", "name", DzGetGameUI(), "template", 0))

        // 第一个按钮
        set i = 1
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(0, 0), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 2
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(0, 1), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 3
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(0, 2), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 4
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(0, 3), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 5
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(1, 0), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 6
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(1, 1), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 7
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(1, 2), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 8
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(1, 3), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 9
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(2, 0), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 10
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(2, 1), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 11
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(2, 2), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 12
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(2, 3), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

    endfunction

    // 技能按钮显示模型(第二套，一个格子同时显示两套特效就用到了)
    private function initSkillCommand2 takes nothing returns nothing
        local integer ui = StringHash("技能格子刷新特效two")
        local integer i

        // 创建一个统一的父
        set i = 0
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("FRAME", "name", DzGetGameUI(), "template", 0))

        // 第一个按钮
        set i = 1
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(0, 0), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 2
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(0, 1), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 3
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(0, 2), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 4
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(0, 3), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 5
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(1, 0), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 6
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(1, 1), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 7
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(1, 2), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 8
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(1, 3), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 9
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(2, 0), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 10
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(2, 1), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 11
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(2, 2), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

        set i = 12
        call SaveInteger(UI_HASH, ui, i, DzCreateFrameByTagName("SPRITE", "name6", LoadInteger(UI_HASH, ui, 0), "template", 0))
        call DzFrameSetModel( LoadInteger(UI_HASH, ui, i), "CardEff1_S.mdx", 0, 0 )
        // call DzFrameSetAnimate( LoadInteger(UI_HASH, ui, i), 0, true )
        call DzFrameSetPoint( LoadInteger(UI_HASH, ui, i), 6, DzFrameGetCommandBarButton(2, 3), 6, 0, 0 )
        call DzFrameShow( LoadInteger(UI_HASH, ui, i), false )

    endfunction

    // 指定格子显示指定模型
    // index 1-12   从行开始数  t表示种类，根据种便宜位置 0 不做任何操作
    function showSkillCommandTx takes integer uid, integer index, string model, integer t returns nothing
        local integer ui = StringHash("技能格子刷新特效")
        local integer btn

        local real x = 0.0 
        local real y = 0.0
        // 天书学习位置不对
        if t == 1 then
            set x = -0.0092
            set y = -0.0146
        endif

        if Player(uid) == GetLocalPlayer() then
            
            if index == 1 then
                set btn = DzFrameGetCommandBarButton(0, 0)
            elseif index == 2 then
                set btn = DzFrameGetCommandBarButton(0, 1)
            elseif index == 3 then
                set btn = DzFrameGetCommandBarButton(0, 2)
            elseif index == 4 then
                set btn = DzFrameGetCommandBarButton(0, 3)
            elseif index == 5 then
                set btn = DzFrameGetCommandBarButton(1, 0)
            elseif index == 6 then
                set btn = DzFrameGetCommandBarButton(1, 1)
            elseif index == 7 then
                set btn = DzFrameGetCommandBarButton(1, 2)
            elseif index == 8 then
                set btn = DzFrameGetCommandBarButton(1, 3)
            elseif index == 9 then
                set btn = DzFrameGetCommandBarButton(2, 0)
            elseif index == 10 then
                set btn = DzFrameGetCommandBarButton(2, 1)
            elseif index == 11 then
                set btn = DzFrameGetCommandBarButton(2, 2)
            elseif index == 12 then
                set btn = DzFrameGetCommandBarButton(2, 3)
            endif

            call DzFrameShow( LoadInteger(UI_HASH, ui, 0), true )
            call DzFrameSetPoint( LoadInteger(UI_HASH, ui, index), 6, btn, 6, x, y )
            call DzFrameSetModel( LoadInteger(UI_HASH, ui, index), model, 0, 0 )
            call DzFrameShow( LoadInteger(UI_HASH, ui, index), true )
        endif
    endfunction

    // 指定格子显示指定模型
    // index 1-12   从行开始数  t表示种类，根据种便宜位置 0 不做任何操作
    function showSkillCommandTx2 takes integer uid, integer index, string model, integer t returns nothing
        local integer ui = StringHash("技能格子刷新特效two")
        local integer btn

        local real x = 0.0 
        local real y = 0.0
        // 暴击需要偏移
        if t == 2 then
            set x = 0.02
            set y = 0.015
        endif

        if Player(uid) == GetLocalPlayer() then
            
            if index == 1 then
                set btn = DzFrameGetCommandBarButton(0, 0)
            elseif index == 2 then
                set btn = DzFrameGetCommandBarButton(0, 1)
            elseif index == 3 then
                set btn = DzFrameGetCommandBarButton(0, 2)
            elseif index == 4 then
                set btn = DzFrameGetCommandBarButton(0, 3)
            elseif index == 5 then
                set btn = DzFrameGetCommandBarButton(1, 0)
            elseif index == 6 then
                set btn = DzFrameGetCommandBarButton(1, 1)
            elseif index == 7 then
                set btn = DzFrameGetCommandBarButton(1, 2)
            elseif index == 8 then
                set btn = DzFrameGetCommandBarButton(1, 3)
            elseif index == 9 then
                set btn = DzFrameGetCommandBarButton(2, 0)
            elseif index == 10 then
                set btn = DzFrameGetCommandBarButton(2, 1)
            elseif index == 11 then
                set btn = DzFrameGetCommandBarButton(2, 2)
            elseif index == 12 then
                set btn = DzFrameGetCommandBarButton(2, 3)
            endif

            call DzFrameShow( LoadInteger(UI_HASH, ui, 0), true )
            call DzFrameSetPoint( LoadInteger(UI_HASH, ui, index), 6, btn, 6, x, y )
            call DzFrameSetModel( LoadInteger(UI_HASH, ui, index), model, 0, 0 )
            call DzFrameShow( LoadInteger(UI_HASH, ui, index), true )
        endif
    endfunction


    function UIInit_init takes nothing returns nothing
        
        // 初始化进攻倒计时UI
        call showEnemyTimerTip()

        // 鼠标自定义提示初始化
        // call EXExecuteScript("require 'jass.slk'")
        // 自定义提示技能
        // call MouseTipInit()
        // call MouseTipInit2()

        // 提示UI初始化
        // call initTipUI()
        call initTipUI2()

        call initTipUI3()

        // 初始化技能格子模型UI
        call initSkillCommand()
        call initSkillCommand2()

    endfunction
endlibrary
